class Fileobject:
    def __init__(self,name='sample.txt'):
        self.new_file = open(name,'r')
    def __del__(self,name='sample.txt'):
        self.new_file.close()
        del self.new_file
